UNPKG

@frames.js/debugger

Version:

Debug your Frames.js applications

1 lines 6.3 kB
"use strict";(()=>{var e={};e.id=2530,e.ids=[2530],e.modules={85890:e=>{e.exports=require("better-sqlite3")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},6113:e=>{e.exports=require("crypto")},6005:e=>{e.exports=require("node:crypto")},49411:e=>{e.exports=require("node:path")},70362:(e,t,a)=>{a.r(t),a.d(t,{headerHooks:()=>h,originalPathname:()=>j,patchFetch:()=>x,requestAsyncStorage:()=>g,routeModule:()=>f,serverHooks:()=>z,staticGenerationAsyncStorage:()=>b,staticGenerationBailout:()=>v});var r={};a.r(r),a.d(r,{POST:()=>m});var s=a(95419),n=a(69108),i=a(99678),o=a(12725),c=a(6005),l=a.n(c),u=a(72274),d=a(53797);let p=a(49974).M.extend({targetUrl:d.z.string().url()});async function m(e,{params:t}){let a=p.safeParse(await e.json());if(!a.success)return Response.json(a.error.flatten(),{status:400});let r=await (0,u.c)(e.nextUrl.href),s=await r.getNamespace(t.namespaceId);if(!s||"added"!==s.frame.status||!s.frame.notificationDetails)return Response.json({error:"Not found"},{status:404});await r.recordEvent(t.namespaceId,{type:"notification",notification:a.data,id:l().randomUUID()});let n=s.frame.notificationDetails,i=a.data.tokens;return Response.json(o.Tn.parse({result:{invalidTokens:i.filter(e=>e!==n.token),rateLimitedTokens:[],successfulTokens:i.filter(e=>e===n.token)}}))}let f=new s.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/notifications/[namespaceId]/send/route",pathname:"/notifications/[namespaceId]/send",filename:"route",bundlePath:"app/notifications/[namespaceId]/send/route"},resolvedPagePath:"/Users/davidfurlong/Projects/active/frames.js/packages/debugger/app/notifications/[namespaceId]/send/route.ts",nextConfigOutput:"",userland:r}),{requestAsyncStorage:g,staticGenerationAsyncStorage:b,serverHooks:z,headerHooks:h,staticGenerationBailout:v}=f,j="/notifications/[namespaceId]/send/route";function x(){return(0,i.patchFetch)({serverHooks:z,staticGenerationAsyncStorage:b})}},13264:(e,t,a)=>{a.d(t,{nr:()=>r,cL:()=>s,KS:()=>M,cN:()=>h,GN:()=>v,MV:()=>j,Tn:()=>x,_G:()=>w});var r={};a.r(r),a.d(r,{S:()=>i,R:()=>o});var s={};a.r(s),a.d(s,{R:()=>c});class n extends Error{name="BaseError";cause;constructor(e,t={}){super(e,t.cause?{cause:t.cause}:void 0),this.cause=t.cause}}class i extends n{name="AddFrame.InvalidDomainManifest";constructor(){super("Invalid domain manifest")}}class o extends n{name="AddFrame.RejectedByUser";constructor(){super("Add frame rejected by user")}}class c extends n{name="SignIn.RejectedByUser";constructor(){super("Sign in rejected by user")}}var l=a(53797);let u=l.z.string().url().startsWith("https://",{message:"Must be an https url"}).max(512),d=l.z.string().max(32),p=l.z.string().max(32),m=l.z.string().regex(/^#([0-9A-F]{3}|[0-9A-F]{6})$/i,{message:"Invalid hex color code. It should be in the format #RRGGBB or #RGB."}),f=l.z.object({header:l.z.string(),payload:l.z.string(),signature:l.z.string()});l.z.object({fid:l.z.number(),type:l.z.literal("app_key"),key:l.z.string().startsWith("0x")});let g=l.z.object({type:l.z.literal("launch_frame"),name:d,url:u,splashImageUrl:u.optional(),splashBackgroundColor:m.optional()}),b=l.z.discriminatedUnion("type",[g]),z=l.z.object({title:p,action:b}),h=l.z.object({version:l.z.literal("next"),imageUrl:u,button:z}),v=l.z.object({url:l.z.string(),token:l.z.string()}),j=l.z.object({notificationId:l.z.string().max(128),title:l.z.string().max(32),body:l.z.string().max(128),targetUrl:u,tokens:l.z.string().array().max(100)}),x=l.z.object({result:l.z.object({successfulTokens:l.z.array(l.z.string()),invalidTokens:l.z.array(l.z.string()),rateLimitedTokens:l.z.array(l.z.string())})}),y=l.z.object({event:l.z.literal("frame_added"),notificationDetails:v.optional()}),k=l.z.object({event:l.z.literal("frame_removed")}),P=l.z.object({event:l.z.literal("notifications_enabled"),notificationDetails:v.required()}),U=l.z.object({event:l.z.literal("notifications_disabled")}),w=l.z.discriminatedUnion("event",[y,k,P,U]),I=l.z.object({version:l.z.union([l.z.literal("0.0.0"),l.z.literal("0.0.1"),l.z.literal("1"),l.z.literal("next")]),name:d,iconUrl:u,homeUrl:u,imageUrl:u.optional(),buttonTitle:p.optional(),splashImageUrl:u.optional(),splashBackgroundColor:m.optional(),webhookUrl:u.optional()}),M=l.z.object({accountAssociation:f,frame:I.optional()})},49974:(e,t,a)=>{a.d(t,{G:()=>i,M:()=>n});var r=a(13264),s=a(53797);let n=r.MV.extend({targetUrl:s.z.string().url()}),i=r.GN.extend({url:s.z.string().url()})},72274:(e,t,a)=>{a.d(t,{c:()=>r});async function r(e){let{KV_REST_API_TOKEN:t,KV_REST_API_URL:r}=process.env;return t&&r?(await a.e(4096).then(a.bind(a,14096))).getStorage(t,r,e):(await Promise.all([a.e(2725),a.e(9842)]).then(a.bind(a,79842))).getStorage(e)}},93245:(e,t,a)=>{a.d(t,{G:()=>r});class r extends Error{constructor(e,t={}){let a=(()=>{if(t.cause instanceof r){if(t.cause.details)return t.cause.details;if(t.cause.shortMessage)return t.cause.shortMessage}return t.cause?.message?t.cause.message:t.details})(),s=t.cause instanceof r&&t.cause.docsPath||t.docsPath,n=`https://oxlib.sh${s??""}`;super([e||"An error occurred.",...t.metaMessages?["",...t.metaMessages]:[],...a||s?["",a?`Details: ${a}`:void 0,s?`See: ${n}`:void 0]:[]].filter(e=>"string"==typeof e).join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"ox@0.1.1"}),this.cause=t.cause,this.details=a,this.docs=n,this.docsPath=s,this.shortMessage=e}walk(e){return function e(t,a){return a?.(t)?t:t&&"object"==typeof t&&"cause"in t&&t.cause?e(t.cause,a):a?null:t}(this,e)}}}};var t=require("../../../../webpack-runtime.js");t.C(e);var a=e=>t(t.s=e),r=t.X(0,[1638,9947,2725],()=>a(70362));module.exports=r})();